import { datashopAxios } from '@/utils/request'

// 通过授权码获取Access Token
export const codeGetToken = (data: object): Promise<any> => {
  return datashopAxios({
    url: '/api/datashop/v3/auth/oauth/hs/login',
    method: 'post',
    data
  })
}

export const getUserInfo = (params?: object): Promise<any> => {
  return datashopAxios({
    url: '/api/datashop/v3/users/me',
    method: 'get',
    params
  })
}

export const changePwd = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/users/me:change-password`,
    method: 'post',
    data
  })
}

export const refreshToken = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/auth/refresh-token`,
    method: 'post',
    data
  })
}
